package com.cskaoyan.bean.promotion.coupon;

import com.cskaoyan.util.DateUtils;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;

/**
 * @Description:
 * @Author: WD created on 2021-09-16 23:14
 * @Version:
 */
@NoArgsConstructor
@Data
public class UpdateCouponVO {


    private Integer id;
    private String name;
    private String desc;
    private String tag;
    private Integer total;
    private Double discount;
    private Double min;
    private Short limit;
    private Short type;
    private Short status;
    private Short goodsType;
    private Integer[] goodsValue;
    private Short timeType;
    private Short days;
    private String addTime;
    private String updateTime;
    private Boolean deleted;

    public UpdateCouponVO(Integer id, String name, String desc, String tag, Integer total,
                          Double discount, Double min, Short limit, Short type,
                          Short status, Short goodsType, Integer[] goodsValue,
                          Short timeType, Short days, String addTime, String updateTime,
                          Boolean deleted) {
        this.id = id;
        this.name = name;
        this.desc = desc;
        this.tag = tag;
        this.total = total;
        this.discount = discount;
        this.min = min;
        this.limit = limit;
        this.type = type;
        this.status = status;
        this.goodsType = goodsType;
        this.goodsValue = goodsValue;
        this.timeType = timeType;
        this.days = days;
        this.addTime = addTime;
        this.updateTime = updateTime;
        this.deleted = deleted;
    }

    public UpdateCouponVO(Coupon couponBO) {
        this.id = couponBO.getId();
        this.name = couponBO.getName();
        this.desc = couponBO.getDesc();
        this.tag = couponBO.getTag();
        this.total = couponBO.getTotal();
        this.discount = couponBO.getDiscount();
        this.min = couponBO.getMin();
        this.limit = couponBO.getLimit();
        this.type = couponBO.getType();
        this.status = couponBO.getStatus();
        this.goodsType = couponBO.getGoodsType();
        this.goodsValue = couponBO.getGoodsValue();
        this.timeType = couponBO.getTimeType();
        this.days = couponBO.getDays();
        this.addTime =  DateUtils.dateFormat(couponBO.getAddTime());
        this.updateTime = DateUtils.dateFormat(new Date());
        this.deleted = couponBO.getDeleted();
    }
}
